using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class StartPanel : MonoBehaviour
{
    public static StartPanel Instance = null;

    public void Init()
    {
        if (Instance == null) Instance = this;
        transform.Find("StartButton").GetComponent<Button>().onClick.AddListener(OnStartBtnClick);
        transform.Find("PrivacyButton").GetComponent<Button>().onClick.AddListener(OnPrivacyButtonClick);
    }

    public void OnStartBtnClick()
    {
        GameManager.Instance.PlayBtnClickAudio();
        GameManager.Instance.SetPanelState(PanelState.Store);
    }

    public void OnPrivacyButtonClick()
    {
        GameManager.Instance.PlayBtnClickAudio();
        PrivacyPanel.Show();
    }

    public void SetPanelActive(bool isActive)
    {
        gameObject.SetActive(isActive);
        if (isActive)
        {
            if (!PrefsManager.GetBool(Constants.KEY_AGREEPRIVACY))
            {
                PrivacyPanel.Show();
            }
        }
    }
}